package com.opo5.logisticsmanagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.opo5.logisticsmanagement.dao.VehicleInsuranceDao;
import com.opo5.logisticsmanagement.domain.VehicleInsurance;
import com.opo5.logisticsmanagement.service.VehicleInsuranceService;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class VehicleInsuranceImpl extends ServiceImpl<VehicleInsuranceDao, VehicleInsurance> implements VehicleInsuranceService {

    @Autowired(required = false)
    private VehicleInsuranceDao vehicleInsuranceDao;

    @Override
    public IPage<VehicleInsurance> selectPage(int currentPage, int pageSize, VehicleInsurance vehicleInsurance) {
        LambdaQueryWrapper<VehicleInsurance> lqw=new LambdaQueryWrapper<>();
        lqw.eq(Strings.isNotEmpty(vehicleInsurance.getLicensePlate()),VehicleInsurance::getLicensePlate,vehicleInsurance.getLicensePlate());
        IPage<VehicleInsurance>page=new Page<>(currentPage,pageSize);
        vehicleInsuranceDao.selectPage(page,lqw);
        return page;
    }
}
